package com.example.business_oa.controller;


import cn.hutool.poi.excel.ExcelUtil;
import com.example.business_oa.service.BusiService;
import com.example.business_oa.service.HoliService;
import com.example.business_oa.service.QiDongFuLiLiuCheng;
import com.example.business_oa.service.SelectLeaderService;
import com.example.comment_oa.pojos.FlApplyzhu;
import com.example.comment_oa.pojos.SysEmployee;
import com.example.comment_oa.pojos.attendance.BusinessTripAp;
import com.example.comment_oa.pojos.attendance.HolidayAp;
import com.example.comment_oa.response.AjaxResponse;
import com.example.comment_oa.util.EaxyUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@CrossOrigin
@RequestMapping("/businessOa")
public class QingJiaQiDongController {

    @Resource
    QiDongFuLiLiuCheng qiDongFuLiLiuCheng;
    @Resource
    HoliService holiService;


    @Resource
    SelectLeaderService selectLeaderService;

    @PostMapping("/qidongQingJiaLiuCheng")
    public AjaxResponse qidongQingJiaLiuCheng(HolidayAp holidayAp, MultipartFile file){
        //这个是新增请假表
//        EaxyUtils.write();
        int i = holiService.apBusi(holidayAp, file);
        if(i==1){
            String hoWater = holidayAp.getHoWater();
            String userHo = holidayAp.getUserHo();
            //这个是关于流程的
            HashMap<String, Object> variables = new HashMap<>();
            SysEmployee sysEmployee = selectLeaderService.selectGongHao(userHo);

            String assignee1 = sysEmployee.getEmpCard();


            qiDongFuLiLiuCheng.qidongQingJiaLiuCheng(userHo,variables,assignee1,hoWater);
            // System.err.println(Gonghao+","+variables+","+assignee1+","+fulibianhao);
        }
        return AjaxResponse.success(i);
    }


}